import store from 'store'
import expirePlugin from 'store/plugins/expire'

// 添加过期插件
store.addPlugin(expirePlugin)

export const originStoreSet = store.set

store.set = function (...rest) {
  let expire = rest[2] 
  if (typeof expire === 'number' && !isNaN(expire)) {
    expire = new Date().getTime() + expire
    rest[2] = expire
  }
  // @ts-ignore
  return originStoreSet.apply(this, rest)
}